package com.yfp.emqx.config;

import com.yfp.emqx.MqttAcceptClient;
import com.yfp.emqx.MqttCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MqttConfig {
    
    

    @Autowired
    private MqttAcceptClient mqttAcceptClient;

    /**
     * 订阅mqtt
     *
     * @return
     */
    @Conditional(MqttCondition.class)
    @Bean
    public MqttAcceptClient getMqttPushClient() {
    
    
        mqttAcceptClient.connect();
        return mqttAcceptClient;
    }
}
